package com.zzyl.test;

import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONUtil;
import org.junit.Test;

import java.util.HashMap;

public class Study {

    @Test
    public void testProjectInsert() {
        String url = "http://192.168.17.22:8080/nursing/project";
        HashMap<String, Object> map = new HashMap<>();
        map.put("name", "护理项目测试1");
        map.put("orderNo", 1);
        map.put("unit", "次");
        map.put("price", 10.00);
        map.put("image", "https://itheim.oss-cn-beijing.aliyuncs.com/95b0ad37-5d61-4ec2-a961-d6fb691a18f0.png");
        map.put("status", 1);
        HttpResponse response = HttpUtil.createRequest(Method.POST, url).body(JSONUtil.toJsonStr(map))
                .header("authorization", "eyJhbGciOiJIUzUxMiJ9.eyJuaWNrTmFtZSI6IuadqOaiheWQkOawlDYzMjUiLCJpZCI6Mn0.xconSk2vPyT9PHkcuUhyDVpaS3F59FwPhr6V5qv7F-pO_Z15tuaFReR-NH8vjKBT8L5ynslpQ5BDxG1iKhHUBQ")
                .execute();
        if (response.isOk()) {
            System.out.println(response.body());

        }
    }
}
